from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
from flask_login import LoginManager
from flask_bootstrap import Bootstrap

db = SQLAlchemy()
migrate = Migrate()
login_manager = LoginManager()
bootsrtap = Bootstrap()


@login_manager.user_loader
def user_loader(user_id):
    from app.models import User
    return User.query.get(user_id)


login_manager.login_view = 'auth.login'
login_manager.login_message = '需要登陆才能访问'
login_manager.login_message_category = 'warning'
